<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        //创建div标签
        let d = document.createElement("div");
        //给div设置显示文本
        d.innerText = "我是div";
        //将div添加到body中
        document.body.appendChild(d);
        //创建h1和h2
        let h1 = document.createElement("h1");
        let h2 = document.createElement("h2");
        h1.innerText = "这是h1";
        h2.innerText = "这是h2";
        //将h标签添加到body中
        document.body.append(h1,h2);
        //创建图片标签
        let i = document.createElement("img");
        //给元素设置属性
        i.src = "../b.jpg";
        //将img标签添加到body中
        document.body.append(i);
    </script>


</body>
</html>